package cn.itcast.firstmyapp.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class MyHttpServlet
 */
public class MyHttpServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * 接受客户端发送的get请求
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	    // 获取与浏览其绑定的输出流
	    PrintWriter out = response.getWriter();
	    out.println("this servlet is created by eclipse!!!");
	}

	/**
	 * 接受客户端发送的post请求
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	    // 调用doGet方法
        this.doGet(request, response);
	}

}
